/** 该文件仅存放课程模块相关的接口API */
import myaxios from "../MyAxios";
// 引入路径前缀
import BASEURL from "../BaseUrl";
const { BMDURL } = BASEURL;

const courseApi = {

  /**
   * 通过课程id查询课程训练
   * @param {Object}} params  {pid}
   */
  courseTrainByCourseId(params) {
    return myaxios.get(BMDURL + "/v1/course/train", params);
  },


  /**
    * 通过id课程详情
    * @param {Object}} params  {pid}
    */
  courseDetailById(params) {
    return myaxios.get(BMDURL + "/v1/course/detail", params);
  },


  /**
   * 查询所有课程类型
   * @param {Object}} params  {}
   */
  courseType(params) {
    return myaxios.get(BMDURL + "/v1/course/type", params);
  },

  /**
   * 通过课程类型id查询对应课程
   * @param {Object}} params  {c_id}
   */
  courserByTypeId(params) {
    return myaxios.get(BMDURL + "/v1/course/project", params);
  },

  /**
   * 通过pid查询对应课程
   * @param {Object}} params  {pid}
   */
  courserById(params) {
    return myaxios.get(BMDURL + "/v1/course/byId", params);
  },

  /**
   * 通过uid查询对应课程
   * @param {Object}} params  {uid}
   */
  courserUserById(params) {
    return myaxios.get(BMDURL + "/v1/course/byuid", params);
  },

  /**
   * 通过课程查询对应教练
   * @param {Object}} params  {pid}
   */
  coachByCourserId(params) {
    return myaxios.get(BMDURL + "/v1/course/course_coach", params);
  },


  /**
   * 通过课程id查询对应教练
   * @param {Object}} params  {pid}
   */
  coachByCourserTypeId(params) {
    return myaxios.get(BMDURL + "/v1/course/course_type_id", params);
  },

  /**
   * 新增课程
   * @param {Object}} params  {course_id,title,duration,pic,video}
   */
  courseAdd(params) {
    return myaxios.post(BMDURL + "/v1/course/add", params);
  },

  /**
   * 查询所有课程
   * @param {Object}} params  {project_id}
   */
  courseAll(params) {
    return myaxios.get(BMDURL + "/v1/course/project/all", params);
  },

  /**
   * 查询课程的介绍
   * @param {Object}} params  {project_id}
   */
  courseIntroduction(params) {
    return myaxios.get(BMDURL + "/v1/course/introduction", params);
  },

  /**
   * 通过关键字查找课程
   * @param {Object}} params  {title}
   */
  courserByName(params) {
    return myaxios.post(BMDURL + "/v1/course/project", params);
  },

  /**
   * 删除课程
   * @param {Object}} params  {title}
   */
  courserDelete(params) {
    return myaxios.post(BMDURL + "/v1/course/delete", params);
  },

  /**
    * 用户删除课程
    * @param {Object}} params  {id}
    */
  courserUserDelete(params) {
    return myaxios.post(BMDURL + "/v1/course/delete_user", params);
  },

  /**
   * 修改课程信息
   * @param {Object}} params  {duration,title,pic,video,pid}
   */
  courserUpdate(params) {
    return myaxios.post(BMDURL + "/v1/course/update", params);
  },
};

export default courseApi;
